<template>
  <div id="main" style="width: 600px;height:400px;"></div>
</template>
<script>

export default {
  data() {
    return {
      option: {
        title: {
          text: 'ECharts 入门示例'
        },
        xAxis: {
          data: []
        },
        yAxis: {},
        series: [
          {
            name: '销量',
            type: 'bar',
            data: []
          }
        ]
       }
    }
  }, mounted() {
    var elementById = document.getElementById("main");
    this.myChart = this.$echarts.init(elementById);
    this.axios.get(this.$baseUrl+'user/count').then(res=>{
     res.data.data.map(rs=>{
       this.option.xAxis.data.push(rs.name);
       this.option.series[0].data.push(rs.id);
     })
       this.myChart.setOption(this.option);


    })

  }
}
</script>

<style scoped>

</style>
